//
//  KKDataBaseAPIInterface.h
//  FreightAssistant
//
//  Created by Mac mini on 15/12/15.
//  Copyright © 2015年 leo. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^KKDataBaseAPIInterfaceSuccessfulBlock)(id object);
typedef void(^KKDataBaseAPIInterfaceFaileBlock)(NSString *error);

@interface KKDataBaseAPIInterface : NSObject

//  商品接口

+ (void)addCommodityWithRecords:(NSDictionary *)records successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

+ (void)editCommodityWithRecords:(NSDictionary *)records withCommodityIdentifier:(NSString *)identifier successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

+ (void)searchCommodityItemsWithSearchText:(NSString *)searchText withEnabled:(BOOL)enabled successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

+ (void)deleteCommodityItemWithIdentifier:(NSString *)identifier successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;



//  客户接口

+ (void)addCustomerWithRecords:(NSDictionary *)records successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

+ (void)editCustomerWithRecords:(NSDictionary *)records withCommodityIdentifier:(NSString *)identifier successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

+ (void)searchCustomerItemsWithSearchText:(NSString *)searchText withEnabled:(BOOL)enabled successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

+ (void)deleteCustomerItemWithIdentifier:(NSString *)identifier successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;


//  快递接口

+ (void)addLogisticsWithRecords:(NSDictionary *)records successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

+ (void)editLogisticsWithRecords:(NSDictionary *)records withCommodityIdentifier:(NSString *)identifier successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

+ (void)searchLogisticsItemsWithSearchText:(NSString *)searchText withEnabled:(BOOL)enabled successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

+ (void)deleteLogisticsItemWithIdentifier:(NSString *)identifier successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;


/**
 *  新增采购单
 *
 *  @param orderRecords       单据信息
 *  @param customerIdentifier 客户ID
 *  @param commodityItems     物品数组
 *  @param logisticsRecords   物流信息
 *  @param success            成功回调
 *  @param faile              失败回调
 */
+ (void)addPurchaseOrderWithOrderRecords:(NSDictionary *)orderRecords customerIdentifier:(NSString *)customerIdentifier commodityItems:(NSArray *)commodityItems logisticsRecords:(NSDictionary*)logisticsRecords successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

/**
 *  更新采购单的状态
 *
 *  @param identifier 订单ID
 *  @param state      订单状态
 */
+ (void)updatePurchaseOrderStateWithIdentifier:(NSString *)identifier state:(NSInteger)state successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

/**
 *  搜索
 *
 *  @param enabled 是否禁用
 *  @param success 成功回调
 *  @param faile   失败回调
 */
+ (void)searchPurchaseOrderItemsWithEnabled:(BOOL)enabled successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

+ (void)deletePurchaseOrderItemWithIdentifier:(NSString *)identifier successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;


/**
 *  新增代购单
 *
 *  @param orderRecords       单据信息
 *  @param customerIdentifier 客户ID
 *  @param commodityItems     物品数组
 *  @param logisticsRecords   物流信息
 *  @param success            成功回调
 *  @param faile              失败回调
 */
+ (void)addSupplyOrderWithOrderRecords:(NSDictionary *)orderRecords customerIdentifier:(NSString *)customerIdentifier commodityItems:(NSArray *)commodityItems logisticsRecords:(NSDictionary*)logisticsRecords successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

/**
 *  更新采购单的状态
 *
 *  @param identifier 订单ID
 *  @param state      订单状态
 */
+ (void)updateSupplyOrderStateWithIdentifier:(NSString *)identifier state:(NSInteger)state successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

+ (void)searchSupplyOrderItemsWithEnabled:(BOOL)enabled successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

+ (void)deleteSupplyOrderItemWithIdentifier:(NSString *)identifier successful:(KKDataBaseAPIInterfaceSuccessfulBlock)success faile:(KKDataBaseAPIInterfaceFaileBlock)faile;

@end
